﻿<%@ Page Title="" Language="VB" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>

<%@ Import Namespace="Equipment.DataAccess" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Edit Basic Requirement
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="CurrentMenuIDContent" runat="server">
    configMenu</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeadContent" runat="server">
    <link rel="stylesheet" type="text/css" href="../../Content/jquery-ui-1.8.16.custom.css" />
    <link rel="stylesheet" type="text/css" href="../../Content/anytime.css" />
    <script type="text/javascript" src="../../Scripts/jquery-ui-1.8.16.custom.min.js"></script>
    <script type="text/javascript" src="../../Scripts/anytime.js"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2>
        Edit Basic Requirement</h2>
    <br />
    <% Using Html.BeginForm()%>
    <%= Html.ValidationSummary(False) %>
    <fieldset>
        <legend>Basic Requirement</legend>
        <table>
            <tr>
                <td width="130px">
                    <label for="Id">
                        ID:</label>
                </td>
                <td>
                    <%= Html.Encode(ViewData("ID"))%>
                </td>
                <td>
                    &nbsp;
                </td>
                <td class="right">
                    <input type="submit" class="button right" value="     Print     " onclick="print(); return false;"/>
                </td>
            </tr>
            <tr>
                <td>
                    Requirement Name
                </td>
                <td>
                    <%= Html.TextBox("RequirementName", ViewData("RequirementName"), New With {.class = "text"})%>
                    <%= Html.ValidationMessage("RequirementName", "*")%>
                </td>
                <td>
                    &nbsp;
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td>
                    Requirement Type
                </td>
                <td>
                    <%= Html.DropDownList("RequirementType")%>
                </td>
                <td>
                    &nbsp;
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td>
                    Asset Type:
                </td>
                <td>
                    <%= Html.DropDownList("AssetType")%>
                </td>
                <td>
                    &nbsp;
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td class="top">
                    Measures:
                </td>
                <td colspan="3">
                    <% Html.RenderPartial("~/Views/Shared/Grids/MeasureGrid.ascx")%>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    &nbsp;
                </td>
                <td colspan="2" align="right">
                    Table When to Create the Work Order Before Due Date?
                </td>
            </tr>
            <tr>
                <td class="top">
                    Frequency:
                </td>
                <td colspan="3">
                    <table class="struct-table" cellpadding="1px">
                        <tr>
                            <td>
                                <%= Html.RadioButton("rbFrequency", "WhenUsed", ViewData("SelectedFreqWhenUsed") IsNot Nothing)%>&nbsp;When Used
                            </td>
                            <td>
                                 &nbsp;
                            </td>
                            <td>
                                &nbsp;
                            </td>
                            <td>
                                 &nbsp;
                            </td>
                            <td>
                                &nbsp;
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <%= Html.RadioButton("rbFrequency", "EveryXHours", ViewData("SelectedFreqEveryXHours") IsNot Nothing)%>&nbsp;Every
                                X Hours
                            </td>
                            <td>
                                X =
                                <%= Html.TextBox("txtEveryXHours", ViewData("EveryXHours"), New With {.class = "text"})%>
                            </td>
                            <td>
                                &nbsp;
                            </td>
                            <td>
                                <%= Html.TextBox("txtEveryXHoursDueEnd", ViewData("EveryXHoursDueEnd"), New With {.class = "text"})%>
                            </td>
                            <td>
                                Min&nbsp;<%= Html.ValidationMessage("EveryXHours","*")%>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <%= Html.RadioButton("rbFrequency", "TwiceDaily", ViewData("SelectedFreqTwiceDaily") IsNot Nothing)%>&nbsp;Twice
                                Daily
                            </td>
                            <td>
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                <%= Html.TextBox("txtTwiceDailyFirstTime", ViewData("TwiceDailyFirstTime"), New With {.class = "text time-input"})%>
                                <img class="ui-datepicker-trigger" src="../../Content/img/calendar.gif" alt="..."
                                    title="..." onclick="$('#txtTwiceDailyFirstTime').click();" />
                            </td>
                            <td>
                                &nbsp;
                            </td>
                            <td>
                                <%= Html.TextBox("txtTwiceDailySecondTime", ViewData("TwiceDailySecondTime"), New With {.class = "text time-input"})%>
                                <img class="ui-datepicker-trigger" src="../../Content/img/calendar.gif" alt="..."
                                    title="..." onclick="$('#txtTwiceDailySecondTime').click();" />
                            </td>
                            <td>
                                &nbsp;<%= Html.ValidationMessage("TwiceDaily", "*")%>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <%= Html.RadioButton("rbFrequency", "EveryXDays", ViewData("SelectedFreqEveryXDays") IsNot Nothing)%>&nbsp;Every
                                X Days
                            </td>
                            <td>
                                X =
                                <%= Html.TextBox("txtEveryXDays", ViewData("EveryXDays"), New With {.class = "text"})%>
                            </td>
                            <td>
                                Due at 11:59pm
                            </td>
                            <td>
                                <%= Html.TextBox("txtEveryXDaysDueEnd", ViewData("EveryXDaysDueEnd"), New With {.class = "text"})%>
                            </td>
                            <td>
                                Min&nbsp;<%= Html.ValidationMessage("EveryXDays", "*")%>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <%= Html.RadioButton("rbFrequency", "EveryXWeeks", ViewData("SelectedFreqEveryXWeeks") IsNot Nothing)%>&nbsp;Every
                                X Weeks
                            </td>
                            <td>
                                X =
                                <%= Html.TextBox("txtEveryXWeeks", ViewData("EveryXWeeks"), New With {.class = "text"})%>
                            </td>
                            <td>
                                Due end of the week
                            </td>
                            <td>
                                <%= Html.TextBox("txtEveryXWeeksDueEnd", ViewData("EveryXWeeksDueEnd"), New With {.class = "text"})%>
                            </td>
                            <td>
                                Days&nbsp;<%= Html.ValidationMessage("EveryXWeeks", "*")%>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <%= Html.RadioButton("rbFrequency", "EveryXMonth", ViewData("SelectedFreqEveryXMonth") IsNot Nothing)%>&nbsp;Every
                                X Month
                            </td>
                            <td>
                                X =
                                <%= Html.TextBox("txtEveryXMonth", ViewData("EveryXMonth"), New With {.class = "text"})%>
                            </td>
                            <td>
                                Due end of the month
                            </td>
                            <td>
                                <%= Html.TextBox("txtEveryXMonthDueEnd", ViewData("EveryXMonthDueEnd"), New With {.class = "text"})%>
                            </td>
                            <td>
                                Days&nbsp;<%= Html.ValidationMessage("EveryXMonth", "*")%>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <%= Html.RadioButton("rbFrequency", "EveryXYears", ViewData("SelectedFreqEveryXYears") IsNot Nothing)%>&nbsp;Every
                                X Years
                            </td>
                            <td>
                                X =
                                <%= Html.TextBox("txtEveryXYears", ViewData("EveryXYears"), New With {.class = "text"})%>
                            </td>
                            <td>
                                Due end of the year
                            </td>
                            <td>
                                <%= Html.TextBox("txtEveryXYearsDueEnd", ViewData("EveryXYearsDueEnd"), New With {.class = "text"})%>
                            </td>
                            <td>
                                Days&nbsp;<%= Html.ValidationMessage("EveryXYears", "*")%>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td colspan="4">
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td class="top right">
                    For Every X Hours, Twice Daily, Daily:
                </td>
                <td colspan="2">
                    <table>
                        <tr>
                            <td width="300px">
                                <table class="data-table">
                                    <thead>
                                        <tr>
                                            <th>
                                                <%= Html.CheckBox("cbxSelectAll")%>
                                            </th>
                                            <th>
                                                Select One or More of following
                                            </th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr>
                                            <td>
                                                <%= Html.CheckBox("cbxNotHolidayWeekday", ViewData("SelectedNotHolidayWeekday") IsNot Nothing)%>
                                            </td>
                                            <td>
                                                Weekdays that are not holidays
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <%= Html.CheckBox("cbxSundays", ViewData("SelectedSundays") IsNot Nothing)%>
                                            </td>
                                            <td>
                                                Sundays
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <%= Html.CheckBox("cbxSaturdays", ViewData("SelectedSaturdays") IsNot Nothing)%>
                                            </td>
                                            <td>
                                                Saturdays
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <%= Html.CheckBox("cbxHoliday", ViewData("SelectedHoliday") IsNot Nothing)%>
                                            </td>
                                            <td>
                                                Holidays
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </td>
                            <td>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
        <p>
            <input type="submit" class="button right" value="Save" />
        </p>
    </fieldset>
    <div>
        <%: Html.ActionLink("Back to List", "Index") %>
    </div>
    <% End Using%>
    <% Html.RenderPartial("~/Views/Shared/Dialogs/MeasureDialog.ascx")%>
    <form id="print" method="post" target="_blank" action='<%= Url.Content("~/Report/BasicRequirementDetailReport") %>'>
        <%= Html.Hidden("Requirement", ViewData("ID"))%>
    </form>
    <script type="text/javascript">

        $(document).ready(function () {
            $("#cbxSelectAll").change(function () {
                var bActive = $('#cbxSelectAll').is(':checked');
                $('input[name=cbxNotHolidayWeekday]').attr('checked', bActive);
                $('input[name=cbxSundays]').attr('checked', bActive);
                $('input[name=cbxSaturdays]').attr('checked', bActive);
                $('input[name=cbxHoliday]').attr('checked', bActive);
            });
            $('#txtTwiceDailyFirstTime, #txtTwiceDailySecondTime').AnyTime_picker({ format: "%h:%i %p" });
           
        });

        function print(){
            $("form#print").submit();
        }
    </script>
</asp:Content>
